"""
功能描述：实现首页的测试用例
编写人：郭丹
编写日期：2021-12-31
实现逻辑：
        1-导入unittest
        2-实现unittest.TestCase
            2.1-调用driver，启动app，拿到driver对象
            2.2-按照测试用例执行步骤翻译即可
            2.3-断言用例结果
"""

from common.myTest import MyTest
import unittest
from common.logs import logger
from PO.homePage import HomePage
from common.driver import Driver
from common.readExcel import ReadExcel
import time


class HomePageTest(MyTest):

    def ttestSearchSendKeys(self):
        """
        向搜索框输入内容并搜索
        :return:
        """
        #读取readexcle，获取测试数据
        re = ReadExcel()
        classname = self.__class__.__name__
        methodname = self._testMethodName
        #获取到测试数据：
        testdata = re.readData(classname, methodname)
        logger.info(f"获取到的classname:{classname},获取到的methodname:{methodname}")

        hp = HomePage(self.driver)
        hp.clickSearch()
        hp.inputSearchBox(testdata)
        hp.clickSearchBox()
        logger.info('testSearchSendkeys测试用例执行成功')


    def testSwipeUp(self):
        """
        向上滑动屏幕
        :param self:
        :return:
        """
        hp = HomePage(self.driver)
        hp.swipeUp()

    def ttestLogin(self):
        """
        点击未登录按钮
        :return:
        """
        hp = HomePage(self.driver)
        hp.clickBottomLogin()





if __name__ == '__main__':
    unittest.main()


